package proxy;
import com.dys.proxy3.CglibProxy;
import com.dys.proxy3.DoSomeService;
import org.junit.Test;


/**
 * @Author: 疾风
 * @ClassName: SomeProxy
 * @Description: 测试CGLIB代理
 * @CreateDate: 2024/10/21
 * @Version: v1.0.0
 */
public class SomeProxy3 {

    /**
     * JDK动态代理
     */
    @Test
    public void testProxy() {
        // 1.获取目标对象
        DoSomeService target = new DoSomeService();
        // 2.获取代理对象
        DoSomeService proxy = new CglibProxy(target).createTarget();
        // 3.通过代理对象执行方法
        System.out.println("proxy.doSomething() = " + proxy.doSomething());
    }
}
